<app-filter-pocket (enterEvt)="search($event)">
  <input [(ngModel)]="filter.username" nz-input placeholder="请输入账号/姓名" />
  <nz-select
    [(ngModel)]="filter.disabled"
    name="disabled"
    nzPlaceHolder="请选择状态"
    nzAllowClear
  >
    <nz-option
      *ngFor="let item of listOfStatus"
      [nzLabel]="item.text"
      [nzValue]="item.value"
    >
    </nz-option>
  </nz-select>

  <div style="flex: 1"></div>
  <button nz-button nzType="primary" (click)="search(true)">查询</button>
  <button nz-button nzType="primary" (click)="onNavToAdd()">新增</button>
</app-filter-pocket>
<nz-table
  #basicTable
  nzSize="small"
  [nzData]="listOfData"
  nzShowSizeChanger
  [nzLoading]="loading"
>
  <thead>
    <tr>
      <th>账号</th>
      <th>姓名</th>
      <th>角色</th>
      <th>电话</th>
      <th>邮箱</th>
      <th>操作</th>
    </tr>
  </thead>
  <tbody>
    <tr *ngFor="let data of basicTable.data">
      <td>{{ data.username }}</td>
      <td>{{ data.realname }}</td>
      <td>{{ data.roleStr }}</td>
      <td>{{ data.mobile }}</td>
      <td>{{ data.email }}</td>
      <td style="white-space: nowrap">
        <a (click)="onNavToEdit(data)">编辑</a>
        <nz-divider nzType="vertical"></nz-divider>
        <nz-switch
          [(ngModel)]="!data.disabled"
          [nzControl]="true"
          (click)="onClickSwitch(data)"
          [nzLoading]="loadingOfSwitch"
          nzCheckedChildren="启用"
          nzUnCheckedChildren="禁用"
        ></nz-switch>
        <nz-divider nzType="vertical"></nz-divider>
        <a
          nz-popconfirm
          nzPopconfirmTitle="确定删除?"
          (nzOnConfirm)="onDelete(data._id)"
        >
          删除
        </a>
        <nz-divider nzType="vertical"></nz-divider>
        <a
          nz-popconfirm
          nzPopconfirmTitle="确定重置密码(123456)?"
          (nzOnConfirm)="onResetPwd(data._id)"
        >
          重置密码
        </a>
      </td>
    </tr>
  </tbody>
</nz-table>
<app-edit-account
  [isVisible]="isVisible"
  (editCancel)="onEditCancel($event)"
  [data]="eidtData"
></app-edit-account>
